package server.layer;

import org.json.JSONException;
import org.json.JSONObject;

import java.util.Date;

/**
 * Created by IntelliJ IDEA.
 * User: Awake
 * Date: 23.02.12
 * Time: 8:44
 * To change this template use File | Settings | File Templates.
 */
public class Person {
    private Long person_id;
    private String fName;
    private String lName;
    private String eMail;
    private Date birthDate;
    private String fileName;

    public byte[] getImgByte() {
        return imgByte;
    }

    public void setImgByte(byte[] imgByte) {
        this.imgByte = imgByte;
    }

    private byte[] imgByte;
    private String description;
    private String imgName;

    public String getFileName() {
        return fileName;
    }

    public void setFileName(String fileName) {
        this.fileName = fileName;
    }

    public String getDescription() {
        return description;
    }

    public void setDescription(String description) {
        this.description = description;
    }

    public Date getBirthDate() {
        return birthDate;
    }

    public void setBirthDate(Date birthDate) {
        this.birthDate = birthDate;
    }

    public String geteMail() {
        return eMail;
    }

    public void seteMail(String eMail) {
        this.eMail = eMail;
    }

    public String getImgName() {
        return imgName;
    }

    public void setImgName(String imgName) {
        this.imgName = imgName;
    }

    public String getfName() {
        return fName;
    }

    public void setfName(String fName) {
        this.fName = fName;
    }


    public String getlName() {
        return lName;
    }

    public void setlName(String lName) {
        this.lName = lName;
    }


    public Long getPerson_id() {
        return person_id;
    }

    public void setPerson_id(Long id) {
        this.person_id = id;
    }

    public String getFirstName() {
        return fName;
    }

    public void setFirstName(String fName) {
        this.fName = fName;
    }

    public String getLastName() {
        return lName;
    }

    public void setLastName(String lName) {
        this.lName = lName;
    }

    public JSONObject serializePerson() {
        JSONObject object = new JSONObject();
        try{
        object.put("person_id", person_id);
        object.put("fName", fName);
        object.put("lName", lName);
        object.put("eMail", eMail);
            if (birthDate != null){
        object.put("birthDate", birthDate.getTime());
            }
        object.put("fileName", fileName);
        } catch (JSONException e){
            e.printStackTrace();
        }
        return object;
    }

}
